home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef _UTILITYFUNCTIONS_
- #define _UTILITYFUNCTIONS_
-
- #ifdef __cplusplus
- extern "C"
- {
- #endif
-
- /* Macros */
- #define MAX(x,y)((x)<(y)?(y):(x))
- #define MIN(x,y)((x)<(y)?(x):(y))
- #define ABS(x)((x)<0?(-1*(x)):(x))
-
- #define RECT_EQUAL(a,b) {a.top = b.top; a.left=b.left; a.right=b.right; a.bottom=b.bottom;}
-
-
- /* prototypes */
-
- /* returns a floating point between lowBound and highBound with uniform distribution. */
- float UtilRandomFloat (float lowBound, float highBound);
- long UtilRandomLong (long lowBound, long highBound);
-
- /* if seed is 0, initializes to time, otherwise sets to that seed */
- void UtilSeedRandom (long seed);
-
- float UtilEuclideanDistance (float x1, float y1, float x2, float y2);
- void NormalizeVector (float *x, float *y);
-
- /* solves the Least Squares approximation to a linear fit of a set of points */
- void UtilLeastSquareLineApprox (float *x, float *y, long numPoints, float *slope, float *yIntercept);
-
- #ifdef __cplusplus
- }
- #endif
-
-
- #endif /* _UTILITYFUNCTIONS_ */